package com.bdbit.ChargingStation.entity;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.math.BigDecimal;
import java.util.Date;

public class bean_order {
    private Long id;                    // 订单ID（数据库自增主键）
    private String orderId;             // 业务订单号（自定义）

    @JsonProperty("open_id")
    private String userId;              // 用户ID
    private String orderYearMonth;      // 订单创建时间（年月份）
    private Integer status;             // 订单状态：0-未支付,1-进行中,2-已完成,3-已退款
    private String pileId;              // 充电桩ID（改为String类型，用于存储业务订单号）

    @JsonProperty("region_code")
    private String regionCode;          // 区域编码

    @JsonProperty("ele_code")
    private String eleCode;             // 电桩号
    private BigDecimal chargingKwh;    // 充电量（千瓦时）
    private BigDecimal unitPrice;       // 充电单价（元/千瓦时）
    private BigDecimal totalAmount;     // 订单总金额（实际消费金额）

    @JsonProperty("prepay_amount")
    private BigDecimal prepayAmount;    // 订单预付金额
    private Date startTime;             // 充电开始时间
    private Date endTime;               // 充电结束时间
    private Integer reportedDuration;   // 上报充电时长（分钟）
    private Date deviceStartTime;       // 设备上报开始时间
    private Date deviceEndTime;         // 设备上报结束时间
    private String paymentMethod;       // 支付方式：WECHAT,ALIPAY,UNIONPAY
    private Date paymentTime;           // 支付时间
    private BigDecimal refundAmount;    // 退款金额
    private Date refundTime;            // 退款时间
    private Date createDate;            // 订单创建日期（年月日）
    private Date updateDate;            // 订单更新日期（年月日）
    private Integer isDeleted;          // 逻辑删除：0-未删除,1-已删除

    // 无参构造器
    public bean_order() {
    }

    // Getter和Setter方法
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getOrderYearMonth() {
        return orderYearMonth;
    }

    public void setOrderYearMonth(String orderYearMonth) {
        this.orderYearMonth = orderYearMonth;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

//    public Long getPileId() {
//        return pileId;
//    }
//
//    public void setPileId(Long pileId) {
//        this.pileId = pileId;
//    }
// 添加获取业务订单号的方法
public String generateBusinessOrderId() {
    if (this.orderId != null && !this.orderId.isEmpty()) {
        return this.orderId;
    }
    return "ORD" + System.currentTimeMillis();
}
    public String getPileId() {
        return pileId;
    }

    public void setPileId(String pileId) {
        this.pileId = pileId;
    }
    public String getRegionCode() {
        return regionCode;
    }

    public void setRegionCode(String regionCode) {
        this.regionCode = regionCode;
    }

    public String getEleCode() {
        return eleCode;
    }

    public void setEleCode(String eleCode) {
        this.eleCode = eleCode;
    }

    public BigDecimal getChargingKwh() {
        return chargingKwh;
    }

    public void setChargingKwh(BigDecimal chargingKwh) {
        this.chargingKwh = chargingKwh;
    }

    public BigDecimal getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(BigDecimal unitPrice) {
        this.unitPrice = unitPrice;
    }

    public BigDecimal getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }

    public BigDecimal getPrepayAmount() {
        return prepayAmount;
    }

    public void setPrepayAmount(BigDecimal prepayAmount) {
        this.prepayAmount = prepayAmount;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public Integer getReportedDuration() {
        return reportedDuration;
    }

    public void setReportedDuration(Integer reportedDuration) {
        this.reportedDuration = reportedDuration;
    }

    public Date getDeviceStartTime() {
        return deviceStartTime;
    }

    public void setDeviceStartTime(Date deviceStartTime) {
        this.deviceStartTime = deviceStartTime;
    }

    public Date getDeviceEndTime() {
        return deviceEndTime;
    }

    public void setDeviceEndTime(Date deviceEndTime) {
        this.deviceEndTime = deviceEndTime;
    }

    public String getPaymentMethod() {
        return paymentMethod;
    }

    public void setPaymentMethod(String paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

    public Date getPaymentTime() {
        return paymentTime;
    }

    public void setPaymentTime(Date paymentTime) {
        this.paymentTime = paymentTime;
    }

    public BigDecimal getRefundAmount() {
        return refundAmount;
    }

    public void setRefundAmount(BigDecimal refundAmount) {
        this.refundAmount = refundAmount;
    }

    public Date getRefundTime() {
        return refundTime;
    }

    public void setRefundTime(Date refundTime) {
        this.refundTime = refundTime;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    @Override
    public String toString() {
        return "ChargingOrder{" +
                "id=" + id +
                ", orderId='" + orderId + '\'' +
                ", userId='" + userId + '\'' +
                ", status=" + status +
                ", pileId=" + pileId +
                ", eleCode='" + eleCode + '\'' +
                ", chargingKwh=" + chargingKwh +
                ", unitPrice=" + unitPrice +
                ", totalAmount=" + totalAmount +
                ", prepayAmount=" + prepayAmount +
                '}';
    }

    public void setOrder_status(int i) {

    }
}